Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added another method to 2sum Problem #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
ignacio-chiazzo merged 2 commits into ignacio-chiazzo:master from TemitopeAgbaje:Temitope
Oct 8, 2022

Conversation

Copy link
Contributor

@TemitopeAgbaje TemitopeAgbaje commented Oct 8, 2022

I added another method that can be used to solve 2sum.

kindly review, Thank you

Copy link
Owner

@ignacio-chiazzo ignacio-chiazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for contributing

Comment on lines +44 to 51
for (let i = 0; i < nums.length; i++) {
for (let j = i + 1; j < nums.length; i++) {
if (nums[1] + nums[j] === target) {
return [i, j];
}
}
}
};
Copy link
Owner

@ignacio-chiazzo ignacio-chiazzo Oct 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you encapsulate the new solution into a new method named twoSum2?

There are other examples in other files like CoinChange https://github.com/ignacio-chiazzo/Algorithms-Leetcode-Javascript/blob/08563058f7e93ce1688956cc26d5dc2a98b36d1a/LeetcodeProblems/Algorithms/Coin_Change.js.

Also, could you run the tests for both functions twoSum and twoSum2?

Copy link
Contributor Author

@TemitopeAgbaje TemitopeAgbaje Oct 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright.. i would fix that

Copy link
Contributor Author

I have updated it..
Please review.
Thank you

Copy link
Owner

@ignacio-chiazzo ignacio-chiazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

TemitopeAgbaje reacted with hooray emoji
@ignacio-chiazzo ignacio-chiazzo merged commit 8f5e2d1 into ignacio-chiazzo:master Oct 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ignacio-chiazzo ignacio-chiazzo ignacio-chiazzo approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /